using UnityEngine;

namespace ProceduralPrimitivesUtil
{
	public class Ring : PPBase
	{
		[Header("Basic parameters")]
		public float radius1 = 1f;

		public float radius2 = 0.5f;

		[Header("Segments")]
		public int sides = 20;

		public int segments = 3;

		[Header("Slice")]
		public bool sliceOn;

		public float sliceFrom;

		public float sliceTo = 360f;

		[Header("Mapping Coordinates")]
		public bool generateMappingCoords = true;

		public bool realWorldMapSize;

		public Vector2 UVOffset = new Vector2(0f, 0f);

		public Vector2 UVTiling = new Vector2(1f, 1f);

		[Header("Others")]
		public bool flipNormals;

		protected override void CreateMesh()
		{
			m_mesh.name = "Ring";
			radius1 = Mathf.Clamp(radius1, 1E-05f, 10000f);
			radius2 = Mathf.Clamp(radius2, 1E-05f, radius1);
			segments = Mathf.Clamp(segments, 1, 100);
			sides = Mathf.Clamp(sides, 3, 100);
			sliceFrom = Mathf.Clamp(sliceFrom, 0f, 360f);
			sliceTo = Mathf.Clamp(sliceTo, sliceFrom, 360f);
			CreateRing(pivotOffset + Vector3.zero, m_rotation * Vector3.forward, m_rotation * Vector3.right, radius1, radius2, sides, segments, sliceOn, sliceFrom, sliceTo, generateMappingCoords, realWorldMapSize, UVOffset, UVTiling, flipNormals);
		}
	}
}
